const express = require('express');
const router = express.Router();

router.get('/forCurrentUser', (req, res) => {
    const content = [];
    for(let i = 0; i < 100; i++) content.push({
        id: `id${i}`,
        code: `513200${i}`,
        dealerCode: `dealerCode${i}`,
        dealerName: `dealerName${i}`,
        createTime: '2019-11-19T07:02:58.287Z',
        repairDate: '2019-11-19T07:02:58.287Z',
        vin: `vin${i}`,
        model: `model${i}`,
        customerName: `customerName${i}`,
        originTag: 1,
        purchaseDate: '2019-11-19T07:02:58.287Z',
        mileage: 123,
        claimType: 15051001,
        status: 15061004,
        proposedDisposalAdvice: 'proposedDisposalAdvice',
        dealerClaimCode: 'dealerClaimCode',
        causePartCode: 'causePartCode',
        causePartName: 'causePartName',
        totalAmount: 1111,
        approveAmount: 1234
    });

    res.json({
        message: 'ok',
        payload: {
            content,
            totalElements: 40,
        }
    });
});

router.get('/:id', (req, res) => {
    res.json({
        message: 'ok',
        payload: {
            id: '001',
            dealerCode: 'dealerCode513200001',
            dealerName: 'dealerName1',
            code: 'code',
            createTime: '2019-11-19T07:06:01.124Z',
            originTag: 2,
            claimType: 15051001,
            faultType: 25021001,
            countryCode: 'countryCode',
            vin: 'vin',
            engineCode: 'engineCode',
            transmissionSn: 'transmissionSn',
            purchaseDate: '2019-11-19T07:06:01.124Z',
            repairDate: '2019-11-19T07:06:01.124Z',
            mileage: 112,
            brand: 'brand',
            series: 'series',
            model: 'model',
            customerCompany: 'customerCompany',
            customerName: 'customerName',
            contactPhone: 'contactPhone',
            address: 'address',
            email: 'email',
            laborFee: 111,
            materialFee: 233,
            assistantFee: 21321,
            mgmtFee: 165,
            totalAmount: 564564,
            approveAmount: 1312,
            faultDescription: 'faultDescription',
            aanalysisResult: 'aanalysisResult',
            appraiser: 'appraiser',
            analysisDate: '2019-11-26T06:38:07.786Z',
            proposedDisposalAdvice: 'proposedDisposalAdvice',
            serviceOrderCode: 'serviceOrderCode',
            dealerClaimCode: 'dealerClaimCode',
            authCode: 'authCode',
            claimMaterialDetailHis: [
                {
                    id: 'id001',
                    usedPartCode: 'usedPartCode1',
                    usedPartName: 'usedPartName1',
                    isCaused: true,
                    quantity: 213,
                    price: 123214,
                    sumTotal: 46546,
                    mngRate: 0.20,
                    manageFee: 300,
                },
                {
                    id: 'id002',
                    usedPartCode: 'usedPartCode2',
                    usedPartName: 'usedPartName2',
                    isCaused: 'isCaused2',
                    quantity: 213,
                    price: 123214,
                    sumTotal: 46546,
                    mngRate: 0.20,
                    manageFee: 300,
                }
            ],
            claimLaborDetailHis: [
                {
                    id: '001',
                    partCode: 'partCode',
                    laborCode: 'laborCode1',
                    laborName: 'laborName1',
                    laborHour: 12,
                    price: 546,
                    laborAmount: 213
                }
            ],
            claimAddMaterialDetailHis: [
                {
                    id: '001',
                    partCode: 'partCode1',
                    partName: 'partName1',
                    quantity: 564,
                    price: 4646,
                    unit: 'unit',
                    sumTotal: 5465475,
                }
            ]
        },
        totalElements: 40,
    });
});

router.get('/export/forCurrentUser', (req, res) => {
    res.json({
        message: '导出成功'
    });
});

module.exports = router;
